<template>
  <a-dropdown trigger="click" appendToBody placement="bottom-start" @command="handleCommand">
    <icon-settings class="cursor-pointer" />
    <template #content>
      <a-doption icon="edit-square" @click="handleCommand('edit')" name="edit">编辑</a-doption>
      <a-doption icon="swap" @click="handleCommand('convert')" name="convert">
        {{ `转换为${data.type === "M" ? "维度" : "指标"}` }}
      </a-doption>
      <!--<b-dropdown-item icon="delete" name="delete">删除</b-dropdown-item>-->
    </template>
  </a-dropdown>
</template>

<script>
export default {
  name: "setting-dropdown",
  props: {
    data: {
      type: Object,
      default: () => ({})
    }
  },
  emits: ["command"],
  methods: {
    handleCommand(name) {
      this.$emit("command", { name, node: this.data })
    }
  }
}
</script>
